package com.ruoyi.common.utils.bean;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * 线程方法
 * 用于读取cmd缓冲区中的数据, 防止cmd操作ffmpeg的时候发生阻塞
 */
public class ProcessClearStream extends Thread {

    private BufferedReader br;

    public ProcessClearStream(InputStream stream) {
        br = new BufferedReader(new InputStreamReader(stream));
    }

    @Override
    public void run() {
        try {
            String line = null;
            while ((line = br.readLine()) != null) {
                System.out.println(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}
